home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Object = "{DB797681-40E0-11D2-9BD5-0060082AE372}#4.1#0"; "XceedZip.dll"
- Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
- Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
- Begin VB.Form frmMain
- Caption = "Zip Manager Sample Application (Xceed Zip v4.0)"
- ClientHeight = 5415
- ClientLeft = 2580
- ClientTop = 1515
- ClientWidth = 8775
- Icon = "frmMain.frx":0000
- LinkTopic = "Form1"
- ScaleHeight = 361
- ScaleMode = 3 'Pixel
- ScaleWidth = 585
- Begin VB.PictureBox picStatus
- Align = 2 'Align Bottom
- Height = 315
- Left = 0
- ScaleHeight = 17
- ScaleMode = 3 'Pixel
- ScaleWidth = 581
- TabIndex = 0
- TabStop = 0 'False
- Top = 5100
- Width = 8775
- Begin MSComctlLib.ProgressBar prbGlobalProgress
- Height = 255
- Left = 6120
- TabIndex = 3
- Top = 0
- Visible = 0 'False
- Width = 1770
- _ExtentX = 3122
- _ExtentY = 450
- _Version = 393216
- BorderStyle = 1
- Appearance = 0
- End
- Begin VB.CommandButton cmdAbort
- Caption = "&Abort"
- Enabled = 0 'False
- Height = 260
- Left = 7980
- TabIndex = 1
- Top = 0
- Width = 735
- End
- Begin VB.Label lblProgress
- Caption = "Progress:"
- Height = 255
- Left = 5400
- TabIndex = 4
- Top = 30
- Visible = 0 'False
- Width = 735
- End
- Begin VB.Label lblStatusBar
- Caption = "No zip file currently opened."
- Height = 255
- Left = 45
- TabIndex = 2
- Top = 30
- Width = 5220
- End
- End
- Begin MSComDlg.CommonDialog dlgSelectFiles
- Left = 8400
- Top = 8280
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin MSComDlg.CommonDialog dlgSelectZip
- Left = 8880
- Top = 8280
- _ExtentX = 847
- _ExtentY = 847
- _Version = 393216
- End
- Begin MSComctlLib.ListView lstMain
- Height = 4575
- Left = 0
- TabIndex = 5
- Top = 0
- Width = 7935
- _ExtentX = 13996
- _ExtentY = 8070
- View = 3
- Arrange = 2
- LabelEdit = 1
- MultiSelect = -1 'True
- LabelWrap = -1 'True
- HideSelection = 0 'False
- FullRowSelect = -1 'True
- TextBackground = -1 'True
- _Version = 393217
- ForeColor = 0
- BackColor = -2147483643
- Appearance = 1
- NumItems = 12
- BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- Text = "Name"
- Object.Width = 2646
- EndProperty
- BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 1
- Text = "Comment"
- Object.Width = 2469
- EndProperty
- BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 2
- Text = "Size"
- Object.Width = 1323
- EndProperty
- BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 3
- Text = "Packed"
- Object.Width = 1323
- EndProperty
- BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 4
- Text = "Attributes"
- Object.Width = 1429
- EndProperty
- BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 5
- Text = "CRC"
- Object.Width = 1984
- EndProperty
- BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 6
- Text = "Last Modified"
- Object.Width = 3175
- EndProperty
- BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 7
- Text = "Last Accessed"
- Object.Width = 3175
- EndProperty
- BeginProperty ColumnHeader(9) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 8
- Text = "Created"
- Object.Width = 3175
- EndProperty
- BeginProperty ColumnHeader(10) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 9
- Text = "Path"
- Object.Width = 2646
- EndProperty
- BeginProperty ColumnHeader(11) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 10
- Text = "Method"
- Object.Width = 1323
- EndProperty
- BeginProperty ColumnHeader(12) {BDD1F052-858B-11D1-B16A-00C0F0283628}
- SubItemIndex = 11
- Text = "Encrypted"
- Object.Width = 1852
- EndProperty
- End
- Begin XceedZipLibCtl.XceedZip xZip
- Left = 8160
- Top = 4440
- BasePath = ""
- CompressionLevel= 6
- EncryptionPassword= ""
- RequiredFileAttributes= 0
- ExcludedFileAttributes= 24
- FilesToProcess = ""
- FilesToExclude = ""
- MinDateToProcess= 2
- MaxDateToProcess= 2958465
- MinSizeToProcess= 0
- MaxSizeToProcess= 0
- SplitSize = 0
- PreservePaths = -1 'True
- ProcessSubfolders= 0 'False
- SkipIfExisting = 0 'False
- SkipIfNotExisting= 0 'False
- SkipIfOlderDate = 0 'False
- SkipIfOlderVersion= 0 'False
- TempFolder = ""
- UseTempFile = -1 'True
- UnzipToFolder = ""
- ZipFilename = ""
- SpanMultipleDisks= 2
- ExtraHeaders = 10
- ZipOpenedFiles = 0 'False
- BackgroundProcessing= 0 'False
- SfxBinrayModule = ""
- SfxDefaultPassword= ""
- SfxDefaultUnzipToFolder= ""
- SfxExistingFileBehavior= 0
- SfxReadmeFile = ""
- SfxExecuteAfter = ""
- SfxInstallMode = 0 'False
- SfxProgramGroup = ""
- SfxProgramGroupItems= ""
- SfxExtensionsToAssociate= ""
- SfxIconFilename = ""
- End
- Begin VB.Menu mnuFile
- Caption = "&File"
- Begin VB.Menu mnuFileNew
- Caption = "&New Zip File"
- End
- Begin VB.Menu mnuFileOpen
- Caption = "&Open Zip File"
- End
- Begin VB.Menu mnuFileLine1
- Caption = "-"
- End
- Begin VB.Menu mnuFileSettings
- Caption = "&Options..."
- End
- Begin VB.Menu mnuFileLine2
- Caption = "-"
- End
- Begin VB.Menu mnuFileColConfig
- Caption = "&Column settings..."
- End
- Begin VB.Menu mnuFileLine3
- Caption = "-"
- End
- Begin VB.Menu mnuFileExit
- Caption = "&Exit"
- End
- End
- Begin VB.Menu mnuActions
- Caption = "&Actions"
- Begin VB.Menu mnuActionsAdd
- Caption = "&Add files..."
- End
- Begin VB.Menu mnuActionsExtract
- Caption = "&Unzip files..."
- End
- Begin VB.Menu mnuActionsLine1
- Caption = "-"
- End
- Begin VB.Menu mnuActionsRemove
- Caption = "&Delete file(s)..."
- End
- Begin VB.Menu mnuActionsTest
- Caption = "&Test zip file"
- End
- End
- Begin VB.Menu mnuHelp
- Caption = "&Help"
- Begin VB.Menu mnuHelpAbout
- Caption = "&About the Zip Manager Sample Application..."
- End
- End
- Attribute VB_Name = "frmMain"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- ' ===================================================================
- ' DESCRIPTION: Zip Manager Sample Application for VB6
- ' COPYRIGHT: Copyright
- 1995-1999 Xceed Software Inc.
- ' All Rights Reserved.
- ' ===================================================================
- '------------------------------------------------------------------------------------
- ' Update the list view with the contents of the current zip file.
- '------------------------------------------------------------------------------------
- Private Sub UpdateZipContentsList()
- Dim xErr As xcdError
- lstMain.ListItems.Clear
- If Len(xZip.ZipFilename) = 0 Then
- Caption = "Zip Manager Sample Application (Xceed Zip 4)"
- Else
- DisableInterface
- Load frmResults
- xZip.FilesToProcess = ""
- lstMain.Visible = False
- xErr = xZip.ListZipContents
- lstMain.Visible = True
- If frmResults.HasMessages Then
- frmResults.Show vbModal
- End If
- Unload frmResults
-
- If (xErr = xerSuccess) Or (xErr = xerWarnings) Or (xErr = xerFilesSkipped) Then
- lblStatusBar.Caption = xZip.ZipFilename & " opened."
- Caption = xZip.ZipFilename & " - Zip Manager Sample Application (Xceed Zip 4)"
- Else
- lblStatusBar.Caption = "Could not read " & xZip.ZipFilename
- xZip.ZipFilename = ""
- Caption = "Zip Manager Sample Application (Xceed Zip 4)"
- End If
- End If
- EnableInterface
- End Sub
- '------------------------------------------------------------------------------------
- 'Aborts the current operation
- '------------------------------------------------------------------------------------
- Private Sub cmdAbort_Click()
- xZip.Abort = True
- End Sub
- '------------------------------------------------------------------------------------
- ' Stores the initial position of various objects for resizing purposes and
- ' disables some menu items
- '------------------------------------------------------------------------------------
- Private Sub Form_Load()
- ' Enable or disable based on initial setup
- UpdateZipContentsList
- End Sub
- '------------------------------------------------------------------------------------
- ' When the form is resized, the objects on it must be repositionned in order
- ' to stay in their correct locations
- '------------------------------------------------------------------------------------
- Private Sub Form_Resize()
- lstMain.Width = frmMain.ScaleWidth
- lstMain.Height = frmMain.ScaleHeight - picStatus.Height
- ' Since the picture box is not yet resized, we use the form's dimensions
- cmdAbort.Left = frmMain.ScaleWidth - cmdAbort.Width - 4
- End Sub
- '------------------------------------------------------------------------------------
- ' The "Action" main menu is selected. We update the state of the "Remove files..."
- ' submenu depending if files are selected
- '------------------------------------------------------------------------------------
- Private Sub mnuActions_Click()
- Dim i As Integer
- For i = 1 To lstMain.ListItems.Count
- If lstMain.ListItems(i).Selected Then
- mnuActionsRemove.Enabled = True
- Exit Sub
- End If
- Next i
- mnuActionsRemove.Enabled = False
- End Sub
- '------------------------------------------------------------------------------------
- ' "Actions -> Add files..." has been choosen in the menu. Open the frmZip dialog
- ' that will let the user select what and how to zip.
- '------------------------------------------------------------------------------------
- Private Sub mnuActionsAdd_Click()
- Dim xErr As xcdError
- Load frmZip
- If frmZip.ShowForm(xZip) Then
- DisableInterface
- Load frmResults
- lblStatusBar.Caption = "Scanning files to zip..."
- xErr = xZip.Zip
- frmResults.Show vbModal
- Unload frmResults
- EnableInterface
-
- ' Update the zip contents list
- UpdateZipContentsList
- End If
- Unload frmZip
- End Sub
- '------------------------------------------------------------------------------------
- ' "Actions -> Unzip files..." has been choosen in the menu. The frmUnzip
- ' and the FrmResults (event log) will we loaded and the unzipping
- ' operation will be started if the ShowUnzipOptions function returns TRUE.
- '------------------------------------------------------------------------------------
- Private Sub mnuActionsExtract_Click()
- Dim xErr As xcdError
-
- Load frmUnzip
- If frmUnzip.ShowForm(xZip, lstMain.ListItems) Then
- DisableInterface
- Load frmResults
- lblStatusBar.Caption = "Reading zip file..."
- xErr = xZip.Unzip
- frmResults.Show vbModal
- Unload frmResults
- EnableInterface
-
- ' No need to update the interface
- End If
- Unload frmUnzip
- End Sub
- '------------------------------------------------------------------------------------
- ' "Actions -> Remove files..." has been choosen in the menu. If the
- ' LoadRemoveFiles function returns TRUE, it means that the user
- ' confirmed that files should be deleted, and so the FrmResults (event log)
- ' is we loaded and the Xceed Zip object's RemoveFiles method will be called.
- '------------------------------------------------------------------------------------
- Private Sub mnuActionsRemove_Click()
- Dim xErr As xcdError
- If ConfirmRemoveFiles Then
- DisableInterface
- Load frmResults
- xErr = xZip.RemoveFiles
- frmResults.Show vbModal
- Unload frmResults
- EnableInterface
-
- UpdateZipContentsList
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' "Actions -> Test" has been chosen in the menu. This sub. will call the
- ' TestZipFile method. The TestingFile event will alert if errors are found.
- '------------------------------------------------------------------------------------
- Private Sub mnuActionsTest_Click()
- Dim xErr As xcdError
- DisableInterface
- Load frmResults
- xErr = xZip.TestZipFile
- frmResults.Show vbModal
- Unload frmResults
- EnableInterface
- End Sub
- '------------------------------------------------------------------------------------
- ' "File -> Column settings" has been chosen in the menu. The
- ' frmSettingsColumns form will be shown.
- '------------------------------------------------------------------------------------
- Private Sub mnuFileColConfig_Click()
- Load frmOptionsColumns
- frmOptionsColumns.ShowForm xZip
- Unload frmOptionsColumns
- End Sub
- '------------------------------------------------------------------------------------
- ' End of program
- '------------------------------------------------------------------------------------
- Private Sub mnuFileExit_Click()
- Unload Me
- End Sub
- '------------------------------------------------------------------------------------
- ' "File -> New zip file" has been chosen in the menu. A dialog box will be
- ' opened to allow the user to specify the zip file's name and location. Once
- ' that has been done, the sample application's AddFiles function will be called,
- ' which will allow the user to specify files to add into the zip file right away.
- '------------------------------------------------------------------------------------
- Private Sub mnuFileNew_Click()
- Dim sZipFilename As String
-
- sZipFilename = SelectZipFile(NewZip) ' Open a dialog to select the Zip file
- If Len(sZipFilename) > 0 Then
- ' The SelectZipFile dialog already warns the user about the
- ' already existing zip file, so we can delete it if it exists
- If Len(Dir(sZipFilename)) > 0 Then
- Kill sZipFilename
- End If
-
- ' Clear the list and update the view
- UpdateZipContentsList
-
- ' Update current zip file
- xZip.ZipFilename = sZipFilename
-
- ' Fake an adding command
- mnuActionsAdd_Click
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' "File -> Open zip file" has been chosen in the menu. A dialog box is
- ' displayed to allow the user to specify the name and location of the
- ' zip file to open. If any errors occur, a message box will be shown.
- '------------------------------------------------------------------------------------
- Private Sub mnuFileOpen_Click()
- Dim sZipFilename As String
- sZipFilename = SelectZipFile(OpenZip) ' Open a dialog to select the Zip file
- If Len(sZipFilename) > 0 Then
- xZip.ZipFilename = sZipFilename
-
- ' Update the zip contents list
- UpdateZipContentsList
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' "File -> Options..." has been chosen in the menu. The options window will
- ' shown.
- '------------------------------------------------------------------------------------
- Private Sub mnuFileSettings_Click()
- Load frmOptions
- frmOptions.ShowForm xZip
- Unload frmOptions
- End Sub
- '------------------------------------------------------------------------------------
- ' "Help -> About" has been chosen in the menu. The copyright notice will be
- ' displayed.
- '------------------------------------------------------------------------------------
- Private Sub mnuHelpAbout_Click()
- MsgBox "Zip Manager Sample Application for VB6" & vbCrLf & _
- "For the Xceed Zip Compression Library v4.0" & vbCrLf & _
- "Copyright 1995-1999 Xceed Software, All Rights Reserved", vbInformation
- End Sub
- '------------------------------------------------------------------------------------
- ' FileStatus event. This event is triggered when zipping, unzipping, testing, etc.
- ' It allows you to show how much of the current file has actually been processed.
- ' It also allows you to (as we show here) to find out when a file is actually
- ' being zipped or unzipped. This event is triggered once for every 32K processed.
- '------------------------------------------------------------------------------------
- Private Sub xZip_FileStatus(ByVal sFilename As String, ByVal lSize As Long, _
- ByVal lCompressedSize As Long, ByVal lBytesProcessed As Long, _
- ByVal nBytesPercent As Integer, ByVal nCompressionRatio As Integer, _
- ByVal bFileCompleted As Boolean)
- Select Case xZip.CurrentOperation
- Case xcoZipping
- lblStatusBar.Caption = "Zipping file " & sFilename & " (" & CStr(nBytesPercent) & "%)"
- Case xcoUnzipping
- lblStatusBar.Caption = "Unzipping file " & sFilename & " (" & CStr(nBytesPercent) & "%)"
- Case xcoTestingZipFile
- lblStatusBar.Caption = "Testing file " & sFilename & " (" & CStr(nBytesPercent) & "%)"
- Case xcoRemoving
- lblStatusBar.Caption = "Removing file " & sFilename
- End Select
- End Sub
- '------------------------------------------------------------------------------------
- ' GlobalStatus event. This event is triggered throughout operations such as
- ' zipping, unzipping, deleting files, etc. It provides progress information
- ' and statistics for the current operation. Our implementation here uses
- ' GlobalStatus to update the Global Progress bar underneat the main listbox.
- '------------------------------------------------------------------------------------
- Private Sub xZip_GlobalStatus(ByVal lFilesTotal As Long, ByVal lFilesProcessed As Long, _
- ByVal lFilesSkipped As Long, ByVal nFilesPercent As Integer, _
- ByVal lBytesTotal As Long, ByVal lBytesProcessed As Long, _
- ByVal lBytesSkipped As Long, ByVal nBytesPercent As Integer, _
- ByVal lBytesOutput As Long, ByVal nCompressionRatio As Integer)
- prbGlobalProgress.Value = nBytesPercent
- End Sub
- '------------------------------------------------------------------------------------
- ' The InsertDisk event is triggered when another disk is required when reading
- ' or writing spanned zip files.
- '------------------------------------------------------------------------------------
- Private Sub xZip_InsertDisk(ByVal lDiskNumber As Long, bDiskInserted As Boolean)
- Dim xAnswer As VbMsgBoxResult
- If lDiskNumber = 0 Then
- xAnswer = MsgBox("This zip file is part of a multiple disks zip file. Please insert the last disk of the set.", vbInformation + vbOKCancel)
- Else
- xAnswer = MsgBox("Please insert disk #" & CStr(lDiskNumber), vbInformation + vbOKCancel)
- End If
- bDiskInserted = (xAnswer = vbOK)
- End Sub
- '------------------------------------------------------------------------------------
- ' The ListingFile event is triggered for each file listed as a result of
- ' calling the ListZipContents method.
- '------------------------------------------------------------------------------------
- Private Sub xZip_ListingFile(ByVal sFilename As String, ByVal sComment As String, _
- ByVal lSize As Long, ByVal lCompressedSize As Long, _
- ByVal nCompressionRatio As Integer, _
- ByVal xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- ByVal lCRC As Long, ByVal dtLastModified As Date, _
- ByVal dtLastAccessed As Date, ByVal dtCreated As Date, _
- ByVal xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- ByVal bEncrypted As Boolean, ByVal lDiskNumber As Long, _
- ByVal bExcluded As Boolean, _
- ByVal xReason As XceedZipLibCtl.xcdSkippingReason)
- Dim sPathName As String
- Dim nBackslash As Integer
- Dim xItem As ListItem
- nBackslash = InStrRev(sFilename, "\")
- If nBackslash > 0 Then
- sPathName = Left(sFilename, nBackslash - 1) ' Everything before the backslash
- sFilename = Right(sFilename, Len(sFilename) - nBackslash) ' Everything after the backslash
- End If
- If (xAttributes And xfaFolder) > 0 Then
- sFilename = "<dir>"
- End If
- ' Format the information for the item and add it to the main listbox.
- Set xItem = lstMain.ListItems.Add(, , sFilename)
-
- ' Put the file attributes information in the correct list column
- xItem.SubItems(1) = sComment
- xItem.SubItems(2) = lSize
- xItem.SubItems(3) = lCompressedSize
- xItem.SubItems(4) = Attributes(xAttributes)
- xItem.SubItems(5) = Hex(lCRC)
- xItem.SubItems(6) = dtLastModified
- xItem.SubItems(7) = dtLastAccessed
- xItem.SubItems(8) = dtCreated
- xItem.SubItems(9) = sPathName
- xItem.SubItems(10) = xMethod
- xItem.SubItems(11) = bEncrypted
- End Sub
- '------------------------------------------------------------------------------------
- ' The ProcessCompleted event is triggered at the end of every operation. It gives
- ' you information about the operation, including the number of files processed,
- ' the number of files skipped, the compression ratio, and more. If an error has
- ' been detected in any operation, that operation will be canceled and the
- ' ProcessCompleted event will be triggered immediately.
- '------------------------------------------------------------------------------------
- Private Sub xZip_ProcessCompleted(ByVal lFilesTotal As Long, ByVal lFilesProcessed As Long, _
- ByVal lFilesSkipped As Long, ByVal lBytesTotal As Long, _
- ByVal lBytesProcessed As Long, ByVal lBytesSkipped As Long, _
- ByVal lBytesOutput As Long, ByVal nCompressionRatio As Integer, _
- ByVal xResult As XceedZipLibCtl.xcdError)
- Dim sErrorMessage As String
- sErrorMessage = xZip.GetErrorDescription(xvtError, xResult)
- Select Case xZip.CurrentOperation
- Case xcoZipping
- frmResults.AddMessage "Zipping completed: " & sErrorMessage
- lblStatusBar.Caption = "Zipping completed."
- Case xcoUnzipping
- frmResults.AddMessage "Unzipping completed: " & sErrorMessage
- lblStatusBar.Caption = "Unzipping completed."
- Case xcoRemoving
- frmResults.AddMessage "Removing completed: " & sErrorMessage
- lblStatusBar.Caption = "Removing completed."
- Case xcoTestingZipFile
- frmResults.AddMessage "Testing completed: " & sErrorMessage
- lblStatusBar.Caption = "Testing completed."
- End Select
- End Sub
- '------------------------------------------------------------------------------------
- ' The RemovingFile event is triggered when the RemoveFiles method is called. It
- ' gives information about each file being deleted: filename, size, etc.
- '------------------------------------------------------------------------------------
- Private Sub xZip_RemovingFile(ByVal sFilename As String, ByVal sComment As String, _
- ByVal lSize As Long, ByVal lCompressedSize As Long, _
- ByVal xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- ByVal lCRC As Long, ByVal dtLastModified As Date, _
- ByVal dtLastAccessed As Date, ByVal dtCreated As Date, _
- ByVal xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- ByVal bEncrypted As Boolean)
- frmResults.AddMessage "Removing " & sFilename
- End Sub
- '------------------------------------------------------------------------------------
- ' The SkippingFile event is triggered when a file is skipped from an adding or
- ' extracting operation. It does not necessarily mean that the current operation
- ' has caused an error. A file may be skipped due to the RequiredFile attributes,
- ' ExcludedFileAttributes, Min and MaxSize and Min and MaxDate.
- '------------------------------------------------------------------------------------
- Private Sub xZip_SkippingFile(ByVal sFilename As String, ByVal sComment As String, _
- ByVal sFilenameOnDisk As String, ByVal lSize As Long, _
- ByVal lCompressedSize As Long, _
- ByVal xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- ByVal lCRC As Long, ByVal dtLastModified As Date, _
- ByVal dtLastAccessed As Date, ByVal dtCreated As Date, _
- ByVal xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- ByVal bEncrypted As Boolean, _
- ByVal xReason As XceedZipLibCtl.xcdSkippingReason)
- frmResults.AddMessage "Skipping " & sFilename & ": " & xZip.GetErrorDescription(xvtSkippingReason, xReason)
- End Sub
- '------------------------------------------------------------------------------------
- ' The TestingFile event is triggered when a file is read from the zip file for
- ' testing. All files are listed this way. Then the unzipping test starts, and
- ' FileStatus and GlobalStatus are triggered.
- '------------------------------------------------------------------------------------
- Private Sub xZip_TestingFile(ByVal sFilename As String, ByVal sComment As String, _
- ByVal lSize As Long, ByVal lCompressedSize As Long, _
- ByVal nCompressionRatio As Integer, _
- ByVal xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- ByVal lCRC As Long, ByVal dtLastModified As Date, _
- ByVal dtLastAccessed As Date, ByVal dtCreated As Date, _
- ByVal xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- ByVal bEncrypted As Boolean, ByVal lDiskNumber As Long)
- frmResults.AddMessage "Testing " & sFilename
- End Sub
- '------------------------------------------------------------------------------------
- ' The UnzipPreprocessingFile event is triggered before a file gets to the physical
- ' unzipping operation. It does not mean that the unzipping operation is successful.
- '------------------------------------------------------------------------------------
- Private Sub xZip_UnzipPreprocessingFile(ByVal sFilename As String, ByVal sComment As String, _
- sDestFilename As String, ByVal lSize As Long, _
- ByVal lCompressedSize As Long, _
- xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- ByVal lCRC As Long, dtLastModified As Date, _
- dtLastAccessed As Date, dtCreated As Date, _
- ByVal xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- ByVal bEncrypted As Boolean, sPassword As String, _
- ByVal lDiskNumber As Long, bExcluded As Boolean, _
- ByVal xReason As XceedZipLibCtl.xcdSkippingReason, _
- ByVal bExisting As Boolean, _
- xDestination As XceedZipLibCtl.xcdUnzipDestination)
- If (Not bExcluded) Then
- 'Adds a description line to the Results form window
- frmResults.AddMessage "Unzipping " & sFilename
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' The Warning event occurs during any operation that encounters a recoverable error.
- '------------------------------------------------------------------------------------
- Private Sub xZip_Warning(ByVal sFilename As String, ByVal xWarning As XceedZipLibCtl.xcdWarning)
- frmResults.AddMessage "Warning: " & xZip.GetErrorDescription(xvtWarning, xWarning)
- End Sub
- '------------------------------------------------------------------------------------
- ' The ZipContentsStatus event occurs whenever a zip file needs to be read. We only
- ' update the progress bar while listing.
- '------------------------------------------------------------------------------------
- Private Sub xZip_ZipContentsStatus(ByVal lFilesRead As Long, ByVal lFilesTotal As Long, ByVal nFilesPercent As Integer)
- If xZip.CurrentOperation = xcoListing Then
- prbGlobalProgress.Value = nFilesPercent
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' The ZipPreprocessingFile event is triggered right before a file is actually
- ' zipped. You can decide, in this event, whether or not you really want the file
- ' to be zipped (use the bExcluded parameter) or you can change some of the file's
- ' information before it is zipped. This event doesn't mean the file has been
- ' actually zipped yet.
- '------------------------------------------------------------------------------------
- Private Sub xZip_ZipPreprocessingFile(sFilename As String, sComment As String, _
- ByVal sSourceFilename As String, ByVal lSize As Long, _
- xAttributes As XceedZipLibCtl.xcdFileAttributes, _
- dtLastModified As Date, dtLastAccessed As Date, _
- dtCreated As Date, _
- xMethod As XceedZipLibCtl.xcdCompressionMethod, _
- bEncrypted As Boolean, sPassword As String, _
- bExcluded As Boolean, _
- ByVal xReason As XceedZipLibCtl.xcdSkippingReason, _
- ByVal bExisting As Boolean)
- 'Adds a description line to the Results form window if the
- 'file is not excluded from the zipping operation
- If (Not bExcluded) Then
- frmResults.AddMessage "Zipping " & sFilename
- End If
- End Sub
- '------------------------------------------------------------------------------------
- ' Disable all options while processing. Enable the abort button and show the
- ' progress bar.
- '------------------------------------------------------------------------------------
- Public Sub DisableInterface()
- ' Disable menu items
- frmMain.mnuFile.Enabled = False
- frmMain.mnuActions.Enabled = False
- frmMain.mnuHelp.Enabled = False
- ' Activate the Abort button and show the progress bar
- cmdAbort.Enabled = True
- prbGlobalProgress.Visible = True
- lblProgress.Visible = True
- End Sub
- '------------------------------------------------------------------------------------
- ' Enable options depending on current state (zip file opened or not), disable abort
- ' button and hide progress bar.
- '------------------------------------------------------------------------------------
- Public Sub EnableInterface()
- frmMain.mnuActions.Enabled = (Len(xZip.ZipFilename) > 0)
- frmMain.mnuFile.Enabled = True
- frmMain.mnuHelp.Enabled = True
- 'Deactivate the Abort button and hide the progress bar
- cmdAbort.Enabled = False
- prbGlobalProgress.Visible = False
- lblProgress.Visible = False
- End Sub
- '------------------------------------------------------------------------------------
- ' Ask the user to confirm the removal of the selected files.
- '------------------------------------------------------------------------------------
- Private Function ConfirmRemoveFiles() As Boolean
- Dim xAnswer As VbMsgBoxResult
- xAnswer = MsgBox("The selected file(s) will be removed from the zip file. Continue?", vbOKCancel)
- If xAnswer = vbOK Then
- xZip.ProcessSubfolders = False
- xZip.FilesToProcess = GetSelectedFiles(lstMain.ListItems, True)
- End If
- ConfirmRemoveFiles = (xAnswer = vbOK)
- End Function
-